import { RouteObject } from 'src/interface/route';
import loadable from '@loadable/component';
import Layout from 'src/layout';

const Error403 = loadable(() => import('src/pages/error/403'));
const Error404 = loadable(() => import('src/pages/error/404'));
const Error500 = loadable(() => import('src/pages/error/500'));

const errorRoute: RouteObject[] = [
  {
    path: '/error',
    name: '错误页',
    data: {
      locale: 'error_page',
    },
    element: <Layout />,
    children: [
      {
        path: '403',
        name: '403',
        data: {
          locale: 'error.no_permission',
        },
        element: <Error403 />,
      },
      {
        path: '404',
        name: '404',
        data: {
          locale: 'error.not_found',
        },
        element: <Error404 />,
      },
      {
        path: '500',
        name: '500',
        data: {
          locale: 'error.server_error',
        },
        element: <Error500 />,
      },
    ],
  },
];

export default errorRoute;
